package com.smedi.ismedi.progress.api.dto.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class Tasknotice implements ApplicationContextAware {

   private  static ApplicationContext appAware;


    private  static  boolean switchIsOpen = true;


    public Tasknotice() {

        System.out.println();
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        appAware=applicationContext;
        String property = appAware.getEnvironment().getProperty("task-notice.open");
        switchIsOpen = Boolean.parseBoolean(property);
        if(!switchIsOpen){
            log.warn("待办通知未开启");
        }
    }

    /**
     * 获取待办通知配置
     * @return boolean
     */
    public  static  boolean  switchIsOpen(){
        return switchIsOpen;
    }
}
